{$layout}

{$var "header"}
<!-- world map -->
<script type="text/javascript" src="/js/echarts/echarts.min.js"></script>
<script type="text/javascript" src="/js/world.js"></script>
<script type="text/javascript" src="/js/world-countries-map.js"></script>
{$end}

{$template "menu"}

<columns-grid>
    <div class="ui column">
        <h4>今日拦截</h4>
        <div class="value"><span>{{board.countDailyBlocks}}</span>次</div>
    </div>

    <div class="ui column">
        <h4>今日验证码验证</h4>
        <div class="value"><span>{{board.countDailyCaptcha}}</span>次</div>
    </div>

    <div class="ui column">
        <h4>今日记录</h4>
        <div class="value"><span>{{board.countDailyLogs}}</span>次</div>
    </div>

    <div class="ui column">
        <h4>本周拦截</h4>
        <div class="value"><span>{{board.countWeeklyBlocks}}</span>次</div>
    </div>
</columns-grid>

<chart-columns-grid>
    <div class="ui column">
        <!-- 流量地图 -->
        <div v-if="!isLoading">
            <traffic-map-box :v-stats="topCountryStats" :v-is-attack="true"></traffic-map-box>
        </div>
    </div>

    <!-- 最近日志 -->
    <div class="ui column" v-if="accessLogs.length > 0">
        <h4 class="header">最新拦截记录 <a href="/servers/logs?hasWAF=1">更多 &raquo;</a></h4>
        <div class="access-box-box">
            <table class="ui table selectable">
                <tr v-for="accessLog in accessLogs" :key="accessLog.requestId">
                    <td><http-access-log-box :v-access-log="accessLog"></http-access-log-box></td>
                </tr>
            </table>
        </div>
    </div>

    <div class="ui column">
        <!-- 按小时/天统计 -->
        <div class="ui menu text blue">
            <a href="" class="item" :class="{active: requestsTab == 'hourly'}" @click.prevent="selectRequestsTab('hourly')">24小时趋势</a>
            <a href="" class="item" :class="{active: requestsTab == 'daily'}" @click.prevent="selectRequestsTab('daily')">15天趋势</a>
            <div class="item right">
                <span class="color-span" style="background: #F39494">拦截</span>
                <span class="color-span" style="background: #FBD88A">验证码</span>
                <span class="color-span" style="background: #879BD7">记录</span>
            </div>
        </div>
        <div class="ui divider"></div>

        <div class="chart-box" id="hourly-chart" v-show="requestsTab == 'hourly'"></div>
        <div class="chart-box" id="daily-chart" v-show="requestsTab == 'daily'"></div>
    </div>

    <div class="ui column">
        <h4>拦截类型分布</h4>
        <div class="ui divider"></div>
        <div class="chart-box" id="group-chart"></div>
    </div>

    <div class="ui column">
        <!-- 域名排行 -->
        <h4 v-show="!isLoading">域名拦截排行 <span>（24小时）</span></h4>
        <div class="ui divider"></div>
        <div class="chart-box" id="top-domains-chart"></div>
    </div>

    <div class="ui column">
        <!-- 节点排行 -->
        <h4 v-show="!isLoading">节点拦截排行 <span>（24小时）</span></h4>
        <div class="ui divider"></div>
        <div class="chart-box" id="top-nodes-chart"></div>
    </div>
</chart-columns-grid>